﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace HandBook.Common
{
    public class FileManager
    {
        public static string GetFileName(string fileName)
        {
            return fileName + "_" + DateTime.Now.ToString().Replace("/", "_").Replace(":", "_").Replace(" ", "_"); ;
        }

        public static void CreateFile(string filePath)
        {
            FileInfo file = new FileInfo(filePath);
            if(!file.Exists)
                file.Create();
        }

        public static void DeleteFile(string filePath)
        {
            FileInfo file = new FileInfo(filePath);
            if (file.Exists)
                file.Delete();
        }

        public static void CreateFolder(string folderPath)
        {
            if(!Directory.Exists(folderPath))
                Directory.CreateDirectory(folderPath);
        }

        public static void DeleteFolder(string folderPath)
        {
            if (Directory.Exists(folderPath))
                Directory.Delete(folderPath);
        }

        public static bool CheckDirectoryExisting(string folderPath)
        {
            DirectoryInfo dirInfo = new DirectoryInfo(folderPath);
            if (dirInfo.Exists)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
    }
}
